<?php
/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *   An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
 */
function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function phptemplate_preprocess_page(&$vars) {
  $path=base_path().path_to_theme().'/images/';
  $vars['topmenuitems']=l('<img src="'.$path.'icon_home.gif"/>','',$options=array('html'=>TRUE)).
          l('<img src="'.$path.'icon_mail.gif"/>','contact',$options=array('html'=>TRUE)).
          l('<img src="'.$path.'icon_sitemap.gif"/>','sitemap',$options=array('html'=>TRUE));
  $vars['footerbg']='<img class="lb" border="" alt="" src="'.$path.'corner_lb.gif"/>
                    <img class="rb" border="" alt="" src="'.$path.'corner_rb.gif"/>';
  $vars['logo']='<img src="'.base_path().drupal_get_path('theme','wforex').'/images/logo.gif" alt=""/>';
  $vars['tabs2'] = menu_secondary_local_tasks();

  // Hook into color.module
  if (module_exists('color')) {
    _color_page_alter($vars);
  }
}

/**
 * Returns the rendered local tasks. The default implementation renders
 * them as tabs. Overridden to split the secondary tasks.
 *
 * @ingroup themeable
 */
function phptemplate_menu_local_tasks() {
  return menu_primary_local_tasks();
}

/**
 * Returns the themed submitted-by string for the comment.
 */
function phptemplate_comment_submitted($comment) {
  return t('!datetime — !username',
    array(
      '!username' => theme('username', $comment),
      '!datetime' => format_date($comment->timestamp)
    ));
}

/**
 * Returns the themed submitted-by string for the node.
 */
function phptemplate_node_submitted($node) {
  return t('!datetime — !username',
    array(
      '!username' => theme('username', $node),
      '!datetime' => format_date($node->created),
    ));
}

/**
 * Generates IE CSS links for LTR and RTL languages.
 */
function phptemplate_get_ie_styles() {
  global $language;

  $iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />';
  if ($language->direction == LANGUAGE_RTL) {
    $iecss .= '<style type="text/css" media="all">@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";</style>';
  }

  return $iecss;
}

function wforex_page($content, $show_blocks = TRUE) {
  $show_blocks = $show_blocks ? $show_blocks : TRUE;
  return phptemplate_page($content, $show_blocks);
}

function phptemplate_node_submitted($node) {
  return t('@datetime', array(
    '@datetime' => format_date($node->created),
  ));
}